/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package questionbook.service;

import java.util.List;
import org.openrdf.model.URI;
import questionbook.exception.IndividualAlreadyExistsException;
import questionbook.model.Category;
import questionbook.model.Person;
import questionbook.model.Question;
import questionbook.service.common.GenericService;

/**
 * This Service holds all Methods for all CRUD-Operations
 * that belong to the Question-Model
 *
 * @author stefanstift
 */
public interface QuestionService extends GenericService {

    /**
     *
     * @return a Question Object with an generated URI, ready to use and to persist
     * @throws IndividualAlreadyExistsException
     */
    public Question getIdentifiedQuestion() throws IndividualAlreadyExistsException;

    /**
     * Persists the specified Question in the Store
     * @param q
     */
    public void persist (Question q);

    /**
     * Loads the Question with the specified URI from the Store
     *
     * @param uri
     * @return  the Question with the specified URI 
     */
    public Question get(URI uri);

    /**
     * Persists a Link between two Questions in the Store
     *
     * @param q1 Question #1
     * @param q2 Question #2
     */
    public void linkQuestions(Question q1, Question q2);

    /**
     *
     * @param q
     * @return a List of Questions that are linked to the specified Question 
     */
    public List<Question> getLinkedQuestions(Question q);

    /**
     * Removes the Link between two questions form the Store
     *
     * @param q1 Question #1
     * @param q2 Question #2
     */
    public void unlinkQuestions(Question q1, Question q2);

    /**
     *
     * @return a List of all Questions in the Store
     */
    public List<Question> getAll();

    /**
     *
     * @param c
     * @return a List of all Questions within a specified Category
     */
    public List<Question> getByCategory(Category c);

    /**
     *
     * @param p
     * @return a List of all Questions that the specified Person has created
     */
    public List<Question> getByPerson(Person p);

    /**
     * Removes teh specified Question from the Store
     *
     * @param q
     */
    public void delete(Question q);

}
